package org.springcloud.wisdom.amusement.service.serviceimp;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springcloud.wisdom.amusement.dao.Notice_StudentDao;
import org.springcloud.wisdom.amusement.entity.Notice_Student;
import org.springcloud.wisdom.amusement.service.INotice_StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class Notice_StudentServiceImp implements INotice_StudentService {
    @Autowired
    Notice_StudentDao noticeStudentDao;
    @Override
    public List<Notice_Student> getSignStudent(Integer teamid) {
        return noticeStudentDao.getSignStudent(teamid);
    }

    @Override
    public IPage<Notice_Student> getSignStudentPage(int currentPage, int size, Integer teamid) {
        Page<Notice_Student> pageRequest = new Page<>(currentPage, size);
        IPage<Notice_Student> getSignStudentPage = noticeStudentDao.getSignStudentPage(pageRequest,teamid);
        return getSignStudentPage;
    }

    @Override
    public Boolean addSignStudent(Integer teamid, String sid, Integer noticeid) {
        return noticeStudentDao.addSignStudent(teamid, sid, noticeid) > 0;
    }

    @Override
    public Boolean signSuccess(Integer id) {
        if (id == null) return false;
        return noticeStudentDao.signSuccess(id) > 0;
    }

    @Override
    public Boolean signFail(Integer id) {
        if (id == null) return false;
        return noticeStudentDao.signFail(id) > 0;
    }

}
